package com.mz.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mz.common.dto.GlobalException;
import com.mz.common.dto.PaginationVo;
import com.mz.common.dto.R;
import com.mz.common.utils.PageDataHandlerUtils;
import com.mz.entity.vo.FeedbackVo;
import com.mz.service.SmsFeedbackService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/smsFeedback")
public class SmsFeedbackController {

    @Resource
    private SmsFeedbackService smsFeedbackService;

    /**
     * 获取用户反馈分页列表
     * */
    @RequestMapping("/pagination")
    public R getFeedbackpPagination(PaginationVo paginationVo) throws Exception {

        IPage page = smsFeedbackService.getFeedbackpPaginatin(paginationVo);
        return PageDataHandlerUtils.toR(page);
    }

    /**
     * 新增用户反馈
     * */
    @PostMapping("")
    public R addFeedback( @RequestBody FeedbackVo feedbackVo) throws Exception {

        smsFeedbackService.addFeedback(feedbackVo);
        return R.ok();
    }

    /**
     * 删除用户反馈
     * */
    @PostMapping("/remove")
    public R removeFeedback( @RequestBody List<Long> idList ) throws Exception {

        smsFeedbackService.removeFeedback( idList );
        return R.ok();
    }

}
